package com.springmvc.demo.model;



public class AgentOfNCMS {
	/*
	 * NCMS :new rural cooperative medical system 新农合
	 * 农合经办人
	 */
	private String work_number,agent_name,password;
	private String branch_point;
	public String getWork_number() {
		return work_number;
	}
	public void setWork_number(String work_number) {
		this.work_number = work_number;
	}
	public String getAgent_name() {
		return agent_name;
	}
	public void setAgent_name(String agent_name) {
		this.agent_name = agent_name;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getBranch_point() {
		return branch_point;
	}
	public void setBranch_point(String branch_point) {
		this.branch_point = branch_point;
	}

/*	
	public String findAgentNameByWorkNumber(String workNumber) throws SQLException {
		String name="null";
		JdbcUtils jdbcUtils=new JdbcUtils();
		Connection conn=jdbcUtils.getConn();
		PreparedStatement pstmt = null;
		ResultSet rs=null;
		
		try {
			String sql="SELECT * FROM ncms_agent WHERE workNumber=?";
			pstmt=conn.prepareStatement(sql);
			pstmt.setString(1, workNumber);
			
			rs=pstmt.executeQuery();
			if(rs.next()) {
				name=rs.getString("agentName");
			}
		}catch(SQLException e) {
			e.printStackTrace();
		}finally {
			rs.close();
			conn.close();
			
		}
		
		return name;
	}
	
	public void addAgent(String workNumber,String agentName,String password,String branchPoint) throws SQLException {
		JdbcUtils jdbcUtils=new JdbcUtils();
		Connection conn=jdbcUtils.getConn();
		PreparedStatement pstmt = null;
		
		
		try {
			String sql="INSERT INTO ncms_agent VALUES(?,?,?,?)";
			pstmt=conn.prepareStatement(sql);
			
			pstmt.setString(1, workNumber);
			pstmt.setString(2, agentName);
			pstmt.setString(3, password);
			pstmt.setString(4, branchPoint);
			
			pstmt.executeUpdate();

		}catch(SQLException e) {
			e.printStackTrace();
		}finally {
			
			conn.close();
			
		}
	}
	public void delete (String workNumber) throws SQLException {
		JdbcUtils jdbcUtils=new JdbcUtils();
		Connection conn=jdbcUtils.getConn();
		PreparedStatement pstmt = null;
		ResultSet rs=null;
		
		try {
			String sql="DELETE FROM ncms_agent WHERE workNumber=?";
			pstmt=conn.prepareStatement(sql);
			pstmt.setString(1, workNumber);
			
			rs=pstmt.executeQuery();

		}catch(SQLException e) {
			e.printStackTrace();
		}finally {
			rs.close();
			conn.close();
			
		}
		
	}
	*/
}
